<?php
/**
 * 测试专用
 */

defined('InShopNC') or exit('Access Invalid!');

class testControl extends MobileControl {
	public function __construct() {
		parent::__construct();
	}
	
	//地图定位
	public function locationOp(){
		Tpl::showpage('test_location');
	}
	
	//APP快捷支付列表
	public function payOp(){
		//取得平台支付方式
        $model_payment = new gold_paymentModel();
        //支付方式列表
        $condition = array();
        $condition['payment_state'] = '1'; //可用的支付方式
        $payment_list = $model_payment->getList($condition);
        foreach ((array)$payment_list as $v) {
			if(in_array($v['payment_code'],array('alipaywap','alipayapp'))){
                if ($v['payment_online'] == 1) {
                    $online_array[] = $v;
                } else {
                    $offline_array[] = $v;
                }
            }
        }
		Tpl::output('online_array', $online_array);
		Tpl::showpage('test_pay');
	}
	//支付宝支付提交
	public function goto_payOp(){
		include BasePath.'/api/gold_payment/alipayapp/alipayapp.php';
		$payment_id = intval($_REQUEST['payment_id']);
		$payment_model =new gold_paymentModel();
		$condition = array();
		$condition['payment_id'] = $payment_id;
		$payment_info = $payment_model->getRow($payment_id);
		$payment_info['payment_config'] = unserialize($payment_info['payment_config']);
		$payment_orderinfo = array();
		$payment_orderinfo['order_sn']      = predepositModel::recharge_snOrder();
		$payment_orderinfo['order_desc']    = '测试';
		$payment_orderinfo['order_amount']  = 0.01;	
		$payment_orderinfo['discount']		= 0;
		$payment_api = new $payment_info['payment_code']($payment_info,$payment_orderinfo);
         $payment_api->pay_submit();
	}
	//微信支付提交
	public function goto_pay_twoOp(){
		include BasePath.'/api/gold_payment/wxpayapp/wxpayapp.php';
		$payment_id = intval($_REQUEST['payment_id']);
		$payment_model =new gold_paymentModel();
		$condition = array();
		$condition['payment_id'] = $payment_id;
		$payment_info = $payment_model->getRow($payment_id);
		$payment_info['payment_config'] = unserialize($payment_info['payment_config']);
		$payment_orderinfo = array();
		$payment_orderinfo['order_sn']    = predepositModel::recharge_snOrder();
		$payment_orderinfo['order_desc']    = '测试';
		$payment_orderinfo['order_amount']  = 0.01; 
		$payment_orderinfo['discount']		= 0;
		$payment_api = new $payment_info['payment_code']($payment_info,$payment_orderinfo);
         $payment_api->pay_submit();
	}
}